<?php

/**
 * sfFormGuiQuestion form.
 *
 * @package    form
 * @subpackage sf_form_gui_question
 * @version    SVN: $Id: sfPropelFormTemplate.php 6174 2007-11-27 06:22:40Z fabien $
 */
class sfFormGuiQuestionForm extends BasesfFormGuiQuestionForm
{
      protected static $subjects = array(
          'Input' => 'Text',
          'InputCheckbox' => 'Checkbox',
          'InputCheckboxCollection' => 'Checkbox collection',
          'SaveFile' => 'File',
          'Select' => 'ListBox',
          'SelectMany' => 'ListBox (multiple)',
          'Textarea' => 'Textarea'
      );
      
      
  public function configure()
  {
      
      $this->setWidgets(array(
      'id'             => new sfWidgetFormInputHidden(),
      'sf_form_gui_id' => new sfWidgetFormPropelSelect(array('model' => 'sfFormGui', 'add_empty' => false)),
      'name'           => new sfWidgetFormInput(),
      'description'    => new sfWidgetFormTextarea(),
      'widget'         => new sfWidgetFormSelect(array('choices' => self::$subjects)),
      'parameters'         => new sfWidgetFormSelect(array('choices' => self::$subjects)),
      'published'      => new sfWidgetFormInputCheckbox(),
      'required'       => new sfWidgetFormInputCheckbox(),
      'rank'           => new sfWidgetFormInput(),
      'owner_id'       => new sfWidgetFormInput(),
    ));

    $this->setValidators(array(
      'id'             => new sfValidatorPropelChoice(array('model' => 'sfFormGuiQuestion', 'column' => 'id', 'required' => false)),
      'sf_form_gui_id' => new sfValidatorPropelChoice(array('model' => 'sfFormGui', 'column' => 'id')),
      'name'           => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'description'    => new sfValidatorString(array('required' => false)),
      'widget'         => new sfValidatorChoice(array('choices' => array_keys(self::$subjects))),
      'published'      => new sfValidatorBoolean(array('required' => false)),
      'required'       => new sfValidatorBoolean(array('required' => false)),
      'owner_id'       => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('sf_form_gui_question[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

  }
}
